
//
//  MainViewController.m
//  WD-Movies
//
//  Created by 贺泌钦 on 2019/1/23.
//  Copyright © 2019 chuck. All rights reserved.
//

#import "MainViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSArray *array = @[@"MoviesViewController",@"MiddleViewController",@"MineViewController"];
    NSArray *unSelect = @[@"com_icon_film_fault_hdpi",@"com_icon_cinema_default_hdpi",@"com_icon_my_default_hdip"];
    NSArray *select = @[@"com_icon_film_selected.hdpi",@"com_icon_cinema_selected_hdpi",@"com_icon_my_selected_hdpi"];
    //l控制器数组
    NSMutableArray *ViewControllerArray = [NSMutableArray new];
    //设置透明的Tabar (以一个透明的image作为背景图)
    
    //根据控制器的名称创建相应的控制器,并添加k到控制器的数组里
    for (int i = 0; i<array.count; i++) {
        //字符串来创建控制器
        UIViewController *vc = [[NSClassFromString(array[i])alloc] init];
        //添加导航控制器
        UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
        //设置tabbar 的 选中图片,未选中图片 和 标题
        nav.tabBarItem.image = [[UIImage imageNamed:unSelect[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        nav.tabBarItem.selectedImage = [[UIImage imageNamed:select[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        
        [ViewControllerArray addObject:nav];
        
    }
    self.tabBar.backgroundImage = [UIImage imageNamed:@"透明.png"];
    self.tabBar.shadowImage = [[UIImage alloc]init];
   
    self.viewControllers = ViewControllerArray;
}
@end
